import ronin.ai.State;
import ronin.graphics.*;
import ronin.actor2d.*;
import ronin.util.Telegram;

public class TestGlobalState extends State {
	String ownerID;
	Vector2D seekPoint = new Vector2D.Double(400, 400);
	public TestGlobalState(SmartActor owner){
		ownerID = new Integer(owner.uid).toString();
	}
	
	public void enter(SmartActor owner){
		out("GlobalState has been Entered.");

	}
	
	public void exit(SmartActor owner) {
		out("GlobalState has been Exited.");
	}
	
	public void execute(SmartActor owner){
		super.execute((Actor2D) owner);
		System.out.println("Executing state now");
		Vector2D newVelocity = owner.getSteering().seek(seekPoint);
		System.out.println(newVelocity.);
		owner.setVel(newVelocity);
		
	}
	
	public boolean onMessage(SmartActor owner, Telegram message){
		
		if(message.message == AITest1.MSG_NEW_WAYPOINT){
			owner.addToPath((Vector2D) message.extraInfo.get(0));
		}
		
		//out("Bot" + message.receiver.toString()  + " MessageReceived from " + theSender);
		//MessageDispatcher.getInstance().newMessage(0.0, owner.uid, message.sender, 8, new Vector());
		return true;
	}
	
	public void out(String s)
	{
		System.out.println("Bot" + ownerID + ": " + s);
	}
}
